<?php

namespace app\common\model;

/**
 * [Practice  修行表]
 * @author [C。]
 * @return html
 */
class Practice extends Base
{
    protected $name = 'practice';
    /**
     * 根据搜索条件获取列表信息
     */
    public function getList($map,$from = 0, $size = 5,$field='*')
    {
        $order = ['id' => 'desc'];

        $result = $this->field($field)
            ->where($map)
            ->order($order)
            ->limit($from, $size)
            ->select();

        return $result;
    }
    /**
     * 根据搜索条件获取总条数
     */
    public function getCount($map)
    {
        $result = $this->where($map)->count();

        return $result;
    }
    /**
     * 根据搜索条件获取总条数
     */
    public function getRound($map,$field)
    {
        $result = $this->field($field)->where($map)->orderRaw('rand()')->limit(1)->find();

        return $result;
    }
}